From: Arjen Hiemstra Date: Tue, 8 Apr 2025 09:12:26 +0000 (+0200) Subject: [PATCH] controls: Remove redundant states from InlineMessage X-Git-Tag: archive/raspbian/6.13.0-2+rpi1^2~6 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=ba5d1e11e7a157d7703b782c4f138ad339836964;p=kf6-kirigami.git [PATCH] controls: Remove redundant states from InlineMessage States describe changes from a base state. The base state can just be declared normally, there is no need to declare it as a separate state. This fixes centering the close button in single-line inline messages, because the "centered" state was never activated. Gbp-Pq: Name upstream_bae0957d_controls-Remove-redundant-states-from-InlineMessage.patch --- diff --git a/src/controls/templates/InlineMessage.qml b/src/controls/templates/InlineMessage.qml index f8a8688..f293c4b 100644 --- a/src/controls/templates/InlineMessage.qml +++ b/src/controls/templates/InlineMessage.qml @@ -300,6 +300,7 @@ T.Control { left: icon.right leftMargin: Kirigami.Units.largeSpacing top: parent.top + bottom: parent.bottom } width: Math.min(parent.width - parent.fixedContentWidth, implicitWidth) @@ -326,16 +327,6 @@ T.Control { target: label height: label.implicitHeight } - }, - // States are evaluated in the order they are declared. - // This is a fallback state. - State { - name: "single-line" - when: true - AnchorChanges { - target: label - anchors.bottom: label.parent.bottom - } } ] @@ -368,31 +359,22 @@ T.Control { visible: root.showCloseButton - anchors.right: parent.right + anchors { + verticalCenter: parent.verticalCenter + right: parent.right + } // Incompatible anchors need to be evaluated in a given order, // which simple declarative bindings cannot assure - states: [ - State { - name: "onTop" - when: contentLayout.atBottom - AnchorChanges { - target: closeButton - anchors.top: parent.top - anchors.verticalCenter: undefined - } - } , - State { - name: "centered" - AnchorChanges { - target: closeButton - anchors.top: undefined - anchors.verticalCenter: parent.verticalCenter - } + states: State { + name: "onTop" + when: contentLayout.atBottom + AnchorChanges { + target: closeButton + anchors.top: parent.top + anchors.verticalCenter: undefined } - ] - - height: contentLayout.atBottom ? implicitHeight : implicitHeight + } text: qsTr("Close") display: QQC2.ToolButton.IconOnly